/**
 * 
 */
package com.hexacta.hrs.securitygroups;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.vectrics.common.db.RecordObject;

/**
 * Clase que representa las paginas segurizada
 * 
 * @author pgoette
 * 
 */
public class SecurityPage implements RecordObject, Serializable {

    private static final long serialVersionUID = -6632636810697190124L;

    private Long id;

    private String url;

    private Permission permissionRequired;

    public SecurityPage(Permission permissionRequired, String url) {
        super();
        this.permissionRequired = permissionRequired;
        this.url = url;
    }

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Permission getPermissionRequired() {
        return permissionRequired;
    }

    public void setPermissionRequired(Permission permissionRequired) {
        this.permissionRequired = permissionRequired;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (!getClass().isAssignableFrom(obj.getClass())) {
            return false;
        }
        SecurityPage otherSecurityPage = (SecurityPage) obj;
        return new EqualsBuilder().append(this.getUrl(), otherSecurityPage.getUrl()).append(
                this.getPermissionRequired(), otherSecurityPage.getPermissionRequired()).isEquals();
    }

    // usado por hibernate
    public SecurityPage() {
    }

}
